#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

typedef vector<int> ve;
const int inf = 0x3f3f3f3f;
void slove()
{
	int n, m; cin >> n >> m;

	ve a(n + 1);
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	// bool vis[m+1]={false};
	unordered_map<int, int>hash;
	int ret = inf;
	int cnt = 0;
	int indexi = 0;
	int indexj = 0;
	for (int left = 1, right = 1; right <= n; right++)
	{
		// if(hash[])
		int num = a[right];
		//if (hash[num] == 1)continue;
		if (hash[num] == 0)cnt++;//统计有效个数
		hash[num]++;
		while (cnt >= m)
		{
			if (cnt==m&&ret > right - left + 1)
			{
				ret = right - left + 1;  
				indexi = left;  
				indexj = right;  
			}
			hash[a[left]]--;
			if(hash[a[left]]==0)cnt--;
			left++;
		}
		
	}
	cout << indexi << " " << indexj << endl;
}
int main()
{
	int t = 0;
	t = 1;
	while (t--)
	{
		slove();
	}
	return 0;
}